#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){
    
    x = 0;
    y = ofGetHeight()/2;
    
    ofSetBackgroundAuto(false);
    
    ofSetLineWidth(3);
    
    rot = PI;
}

//--------------------------------------------------------------
void testApp::update(){

}

//--------------------------------------------------------------
void testApp::draw(){
    
    x += 0.1f;
    y = ofNoise(x/100.0) * ofGetHeight()/2;
    
    //NOISE
    ofNoFill();
    ofSetColor(255, 0, 0);
    ofCircle(x, y, 10);
    
    
    ofFill();
    ofSetColor(255);
    ofCircle(x, y, 10);
    
    //SIN
    ofNoFill();
    ofSetColor(0, 255, 0);
    ofCircle(x, sin(x/100.0) * 100 + 400, 10);
    
    ofFill();
    ofSetColor(255);
    ofCircle(x, sin(x/100.0) * 100 + 400, 10);
    
    //RANDOM
    int posY = ofRandom(ofGetWindowWidth()/4.0) + ofGetWindowHeight() * .75;
    
    ofNoFill();
    ofSetColor(0, 0, 255);
    ofCircle(x, posY, 10);
    
    
    ofFill();
    ofSetColor(255);
    ofCircle(x, posY, 10);
    
    
    if(x > ofGetWidth()){
    
        x = 0;
    }
    
    if(ofGetKeyPressed(356)){
        rot += 0.01f;
    } else if (ofGetKeyPressed(358)){
        rot -= 0.01f;
    }
    
    
    ofNoFill();
    ofSetColor(0);
    ofCircle(ofGetWindowWidth()/2 + sin(rot) * 100, ofGetWindowHeight()/2 + cos(rot) * 100, 10);
    ofFill();
    ofSetColor(255);
    ofCircle(ofGetWindowWidth()/2 + sin(rot) * 100, ofGetWindowHeight()/2 + cos(rot) * 100, 10);
}

//--------------------------------------------------------------
void testApp::keyPressed(int key){
//    ofLog(OF_LOG_ERROR, "key" + ofToString(key));
//
//    if(key == 356){
//        rot -= 0.1f;
//    } else if (key == 358){
//        rot += 0.1f;
//    }

}

//--------------------------------------------------------------
void testApp::keyReleased(int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){ 

}